package com.huxin.servelt.admin;

import com.alibaba.fastjson.JSON;
import com.huxin.pojo.BookHisInfo;
import com.huxin.pojo.ConditionalQueryDTO;
import com.huxin.pojo.PageBean;
import com.huxin.service.Userservice;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

/**
 *查询用户借阅历史
 */
@WebServlet("/admin/selectAllBookHisInfo")
public class SelectAllbrohisServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Userservice service = new Userservice();
        int page=1;//开始页
        int size=10;//每页显示十条数据
        PageBean<BookHisInfo> pageBean=null;
        String s = request.getReader().readLine();
        ConditionalQueryDTO conditionalQueryDTO = JSON.parseObject(s, ConditionalQueryDTO.class);

        //分页查询
        pageBean=service.findAll(page,size);

        String str= JSON.toJSONString(pageBean);
        response.getWriter().write(str);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }
}
